package com.atguigu04.compare;

import java.util.Arrays;

public class ComparableTest {
    public static void main(String[] args) {
        Product[] products=new Product[5];
        products[0]=new Product("a",45);
        products[1]=new Product("b",213);
        products[2]=new Product("c",654);
        products[3]=new Product("d",213);
        products[4]=new Product("e",5643);

        Arrays.sort(products);

        for (int i = 0; i <products.length ; i++) {
            System.out.println(products[i]);
        }

     }
}
